using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BaHuan.Common;
using BaHuan.Entities;
using BaHuan.DataLayer;
/*
 * There are many processes that handle the flows of data
 * we call them business logic of a program.
 * For each of business logic process we create a class 
 * that handle for that process
 * 
 * */
namespace BaHuan.BusinessLayer
{
	
	public class TaiKhoanMgt
	{
	
		public ResultObj SaveNewTaiKhoan(TaiKhoan taikhoan)
        		{
			ResultObj result = new ResultObj();
			taikhoan.Id = -1;
			TaiKhoanDAO taikhoanDAO = new TaiKhoanDAO();
			result = taikhoanDAO.SaveTaiKhoan(taikhoan);
			
			return result;
		}
		
		public ResultObj UpdateTaiKhoan(TaiKhoan taikhoan)
        		{
			ResultObj result = new ResultObj();
			TaiKhoanDAO taikhoanDAO = new TaiKhoanDAO();
			result = taikhoanDAO.SaveTaiKhoan(taikhoan);
			
			return result;
		}
		
		public ResultObj DeleteTaiKhoan(TaiKhoan taikhoan)
        		{
			ResultObj result = new ResultObj();
			TaiKhoanDAO taikhoanDAO = new TaiKhoanDAO();
			result = taikhoanDAO.DeleteTaiKhoan(taikhoan);
			
			return result;
		}
		
		public ResultObj GetAllTaiKhoan( )
        		{
			ResultObj result = new ResultObj();
			TaiKhoanDAO taikhoanDAO = new TaiKhoanDAO();
			result = taikhoanDAO.GetAllTaiKhoan();
			
			return result;
		}
		
		public ResultObj GetTaiKhoanById(TaiKhoan taikhoan)
        		{
			ResultObj result = new ResultObj();
			TaiKhoanDAO taikhoanDAO = new TaiKhoanDAO();
			result = taikhoanDAO.GetAllTaiKhoanByID(taikhoan);
			
			return result;
		}
					
	}
}
